<template>
	<view class="">
		<u-toast ref="uToast"></u-toast>
		<view class="content u-margin-20 u-padding-30">
			<view class="flex align-center">
				<u-image src="/static/image/home/icon_bank_header.png" width="60" height="60"></u-image>
				<view class="u-margin-left-10 u-font-15">
					{{bankInfo.bankName}}({{bankInfo.accountNo.substring(bankInfo.accountNo.length - 4)}})
				</view>
			</view>
			<view class=" mt-20">
				提现金额
			</view>
			<view class="flex align-center u-border-bottom mt-20">
				<view class="bold ">
					￥
				</view>
				<u-input placeholder="请输入提现金额" v-model="requestBody.money" type="number" :border="false" />
			</view>
			<view class="">
				可提现金额{{info.availableBalance}}元,冻结金额{{info.frozenBalance}}元
			</view>
		</view>
		<u-button class=" " type="primary" :custom-style="customStyle" @click="goWithdraw()">提现</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				customStyle: {
					// 注意驼峰命名，并且值必须用引号包括，因为这是对象
					backgroundColor: '#9D60FF',
					margin: '50rpx 20rpx'
				},
				requestBody: {
					accountType: "",
					accountNo: "",
					money: ""
				},
				info: {},
				bankInfo: {}
			}
		},
		onLoad(options) {
			this.info = JSON.parse(decodeURIComponent(options.item));
			this.bankInfo = JSON.parse(decodeURIComponent(options.bankInfo));

			this.requestBody.accountType = this.info.accountType;
			this.requestBody.accountNo = this.info.accountNo;
			// this.form.legalName = this.basicForm.legalName;

		},
		methods: {
			goWithdraw() {
				const _that = this;
				if (!_that.requestBody.money) {
					uni.$zx.msg("请输入金额", {
						duration: 4000,
					});
					return;
				}
				this.$zx.user_api.withdrawal(_that.requestBody).then((data) => {

					console.log("data=" + JSON.stringify(data))
					this.$refs.uToast.show({
						title: '提交成功',

					})
					uni.navigateBack({
						delta: 1
					});
				});
			}
		},
	}
</script>

<style scoped lang="scss">
	.content {
		background-color: white;
		border-radius: 20rpx;
	}
</style>